/**
 * Copyright (c) 2017 ShopJsp. All Rights Reserved.
 * ============================================================================
 * 版权所有 2011 - 今 北京华宇盈通科技有限公司，并保留所有权利。
 * ----------------------------------------------------------------------------
 * 提示：在未取得SHOPJSP商业授权之前，您不能将本软件应用于商业用途，否则SHOPJSP将保留追究的权力。
 * ----------------------------------------------------------------------------
 * 官方网站：http://www.shopjsp.com
 * ============================================================================
 * @author 张丁方
 * @CreateTime 2017-3-31 13:32:13
 */
package com.hyyt.shopjsp.order.service.imp;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import com.hyyt.shopjsp.order.vo.ShopOrdersListVo;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.hyyt.shopjsp.order.dao.ShopOrdersListDAO;
import com.hyyt.shopjsp.order.pojo.ShopOrdersList;
import com.hyyt.shopjsp.order.service.IShopOrdersListService;

@Service
public class ShopOrdersListService implements IShopOrdersListService {
    private static  final Logger logger = Logger.getLogger(IShopOrdersListService.class);

    @Resource
    private ShopOrdersListDAO shopOrdersListDAO;

    /**
     * 保存SHOP_订单明细
     *
     * @param shopOrdersList SHOP_订单明细
     * @return 保存后的SHOP_订单明细
     */
    @Override
    public void saveShopOrdersList(ShopOrdersList shopOrdersList) {
        shopOrdersListDAO.insert(shopOrdersList);
    }

    /**
     * 更新SHOP_订单明细
     *
     * @param shopOrdersList SHOP_订单明细
     * @return 更新后的SHOP_订单明细
     */
    @Override
    public void updateShopOrdersList(ShopOrdersList shopOrdersList) {
        shopOrdersListDAO.update(shopOrdersList);
    }

    /**
     * 删除指定ID的SHOP_订单明细
     *
     * @param id SHOP_订单明细ID
     */
    @Override
    public void deleteShopOrdersList(Integer id) {
        shopOrdersListDAO.delete(id);
    }

    /**
     * 删除指定ID集合的SHOP_订单明细
     *
     * @param ids SHOP_订单明细ID集合
    */
    public void deleteShopOrdersList(Collection<Integer> ids){
        shopOrdersListDAO.batchDelete(ids);
    }

    /**
     * 根据ID加载一个SHOP_订单明细
     *
     * @param id SHOP_订单明细ID
     * @return SHOP_订单明细
     */
    @Override
    public ShopOrdersList loadShopOrdersList(Integer id) {
        return shopOrdersListDAO.load(id);
    }

    /**
    * 查询所有的SHOP_订单明细，通常有最多取30000条记录的限制
    *
    * @return 所有的SHOP_订单明细，通常有最多取30000条记录的限制
    */
    @Override
    public List<ShopOrdersList> queryAllShopOrdersList() {
        return shopOrdersListDAO.queryAll();
    }

    /**
     * 查询SHOP_订单明细
     *
     * @param params 查询参数，为key-value形式
     * @return SHOP_订单明细集合
     */
    @Override
    public List<ShopOrdersList> queryShopOrdersList(Map<String, Object> params) {
        return shopOrdersListDAO.query(params);
    }

    /**
     * 查询SHOP_订单明细
     *
     * @param params   查询参数，没有则传null,分页参数key为“sortColumns”
     * @param startRow 起始行数（不含起始行的数据）
     * @param rowSize  要查询记录数
     * @return SHOP_订单明细集合
     */
    @Override
    public List<ShopOrdersList> queryShopOrdersList(Map<String, Object> params, int startRow, int rowSize) {
        return shopOrdersListDAO.query(params, startRow, rowSize);
    }

    /**
     * 统计SHOP_订单明细
     *
     * @param params 查询参数，没有则传null,分页参数key为“sortColumns”
     * @return 结果集记录数
     */
    @Override
    public int countShopOrdersList(Map<String, Object> params) {
        return shopOrdersListDAO.count(params);
    }

    /**
     * 查询SHOP_订单明细列表
     *
     * @param params   查询参数，没有则传null,分页参数key为“sortColumns”
     * @param startRow 起始行数（不含起始行的数据）
     * @param rowSize  要查询记录数
     * @return SHOP_订单明细集合
     */
	@Override
	public List<ShopOrdersList> queryListOrdersList(Map<String, Object> params, int startRow, int rowSize) {
		return shopOrdersListDAO.query("queryListOrdersList", params, startRow, rowSize);
	}

    /**
     * 导出HOP_订单明细excel
     * @param params
     * @return
     */
    @Override
    public List<ShopOrdersList> queryListOrdersList(Map<String, Object> params) {
        return shopOrdersListDAO.query("queryListOrdersList", params);
    }

    /**
     * 商品统计列表
     * @param params
     * @param startRow
     * @param rowSize
     * @return
     */
    @Override
    public List<ShopOrdersListVo> queryProductStatistics(Map<String, Object> params, int startRow, int rowSize) {
        return shopOrdersListDAO.query("queryProductStatistics",params, startRow, rowSize);
    }

    /**
     * 导出商品统计excel
     * @param params
     * @return
     */
    @Override
    public List<ShopOrdersListVo> queryProductStatistics(Map<String, Object> params) {
        return shopOrdersListDAO.query("queryProductStatistics",params);
    }
    /**
     * 商品统计数量
     * @param params
     * @return
     */
    @Override
    public int countProductStatistics(Map<String, Object> params) {
        return shopOrdersListDAO.count("countProductStatistics",params);
    }
}